package com.itheima.mp.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.mp.domain.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface UserMapper extends BaseMapper<User> {
    @Update("update user set balance=balance-#{amount} ${ew.customSqlSegment}")
    void updateBalanceByWrapper(@Param("amount") int amount,@Param("ew") LambdaQueryWrapper<User> queryWrapper);
    @Update("Update user set balance=balance-#{amount} where id=#{id}")
    void deductionBalanceById(@Param("amount") int amount, @Param("id") Long id);
}
